package com.huiquan.management.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.huiquan.framework.base.EnhancedBaseDao;
import com.huiquan.management.constant.MigrateCode;
import com.huiquan.management.domain.Migrate;
import com.ibatis.sqlmap.client.SqlMapClient;

@Repository
public class MigrateDao extends EnhancedBaseDao<Migrate> {

	@Resource(name = "sqlMapClient")
	private SqlMapClient sqlMapClient;

	public static final String space = "MIGRATE.";

	public MigrateDao() {
		super(space);
	}

	public Migrate retrieveObjectByCode(String code) {

		Map<String, Object> param = new HashMap<>();
		param.put("code", code);

		return retrieveObjectByMap(param);
	}

	@SuppressWarnings("unchecked")
	public List<Map<String, String>> retrieveMigrateData(MigrateCode mc) {

		return (List<Map<String, String>>) this.list(space + "RETRIEVE_" + mc.name(), sqlMapClient);
	}
}
